home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 January - Disc 2 / Macworld (1999-01) (Disk 2).dmg / Serious Demos / Symbolic Composer 4.2 / Environment / System / DEF / Utilities / Lengths / length-quantize < prev    next >
Lisp/Scheme  |  1998-10-23  |  554b  |  16 lines

  1. length-quantize quant min max vector/list
  2.  
  3. This quantizer is for quantizing metric values. Values can be both ticks and length symbols. Output is always ratios and is applicable to lengths, durations, zones, tempo-zones and grooves.
  4.  
  5. (setq lenpat '(1/2 1/16 1/16 1/16.))
  6. (length-quantize 1/32 1/16 1/4 lenpat)
  7. --> #(7/32 7/32 1/16 1/16)
  8.  
  9. (length-quantize 1/32 1/16 1/4 (gen-sin 1 1 64))
  10. --> #(1/8 1/8 5/32 5/32 5/32 5/32 ...
  11.  
  12. Positive and negative ranges can be used:
  13.  
  14. (length-quantize 1/32. -1/16 1/4 (gen-sin 1 1 64))
  15. --> #(5/64 5/64 5/64 5/64 1/8 ...
  16.